package com.jingbo.servlet;

import com.jingbo.DAO.Record.pecordimpl;
import com.jingbo.service.record.recordimpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author jiangjingbo
 * @version V1.0
 * @Project java2203
 * @Package com.jingbo.servlet
 * @Description:
 * @Date 2022/5/27 15:48
 */
@WebServlet("/delete")
public class deleteOne extends  BeanServlet{
    public String deleteOne(HttpServletRequest request, HttpServletResponse response){
        String id = request.getParameter("id");
        if(id==null){
            return "redirect:/selectAdd.jsp";
        }
        recordimpl recordimpl = new recordimpl(new pecordimpl());
        boolean b = recordimpl.deleteOne(Integer.parseInt(id));
        if(b){
            return "redirect:/selectAll?method=selectAll";
        }else{
            return "redirect:/selectAdd.jsp";
        }
    }
}
